def dz(n):
    s = 0
    for i in range(len(str(n))):
        s += int(str(n)[i])
    return s


def main():
    while True:
        try:
            n = int(input())
            print(dz(n))
        except:
            break


if __name__ == "__main__":
    main()
